package com.leetcode.LC;

public class LC788 {
    public int rotatedDigits(int N) {
        int count=0;
        for (int i = 1; i <= N; i++) {
            if (splitNumber(i)){
                System.out.println(i);
                count++;
            }
        }

        return count;
    }

    public boolean splitNumber(int n) {
        int num, rs = 0,rs2=n;
        String s = String.valueOf(n);
        if (s.contains("3") || s.contains("4") || s.contains("7")) {
            return false;
        }
        int i = 0;
        while (n != 0) {
            num = n % 10;
            n /= 10;
            if (num == 2) {
                num = 5;
            } else if (num == 5) {
                num = 2;
            } else if (num == 6) {
                num = 9;
            } else if (num == 9) {
                num = 6;
            }
            rs += num * Math.pow(10, i);
            i++;
        }
        return rs == rs2 ? false : true;
    }

    public static void main(String[] args) {
        //System.out.println(new LC788().splitNumber(16));
        System.out.println(new LC788().rotatedDigits(10));
    }
}
